
package com.qdu.dao;

import com.qdu.util.DatabaseUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author Lenovo
 */
public class DelManagerDao {
        private static int SUCCESS = 1;
        private static int ERROR = 2;
        private static int SAME = 3;
    	public int delManager(int admin_id){
                    Connection con = null;
                    PreparedStatement ps = null;
                    ResultSet rs = null;

		try{	
                        con = DatabaseUtil.getConnection();
                        ps = con.prepareStatement("delete from systemadministrator where admin_id=?");
                        ps.setInt(1, admin_id);
                        con.commit();
                         
			int i=ps.executeUpdate();
			if(i==1){
				return this.SUCCESS;
			}
			else{
				return this.ERROR;
				}
		}catch(Exception e){
                               e.printStackTrace();
			return this.ERROR;
		}finally{
                  DatabaseUtil.close(rs, ps, con);
		}
	}
    
}
